﻿using System;
using System.Data;

namespace MyCoreLib.Data
{
    /// <summary>
    /// 
    /// </summary>
    public interface IDbClientObject : ICloneable, IDisposable
    {
        /// <summary>
        /// Opens the connection.
        /// </summary>
        /// <returns></returns>
        IDisposable OpenConnection();


        /// <summary>
        /// Begins the transaction.
        /// </summary>
        /// <returns>Transaction</returns>
        IDbTransactionObject BeginTransaction();

        /// <summary>
        /// Begins the transaction.
        /// </summary>
        /// <param name="isolationLevel">The isolation level.</param>
        /// <returns>Transaction</returns>
        IDbTransactionObject BeginTransaction(IsolationLevel isolationLevel);

        /// <summary>
        /// Gets the underlying connection objects state.
        /// </summary>
        /// <value>
        /// State of the underlying connection object
        /// </value>
        ConnectionState State { get; }
    }
}
